<!-- 代码已包含 CSS：使用 TailwindCSS , 安装 TailwindCSS 后方可看到布局样式效果 -->

<template>
  <div class="relative w-full max-w-[375px] mx-auto overflow-hidden bg-white text-gray-800 font-sans">
    <!-- Navbar -->
    <nav class="fixed top-0 left-0 right-0 bg-white z-10 shadow-sm">
      <div class="px-4 py-3 flex items-center justify-between">
        <div class="flex items-center space-x-2">
          <!-- <i class="fas fa-chevron-left text-gray-600 fa-icon w-6 h-6"></i> -->
          <h1 class="text-lg font-medium">{{name}}</h1>
        </div>
        <!-- <a href="#" class="text-primary text-sm font-medium">活动规则</a> -->
      </div>
    </nav>


    <!-- Main Content -->
    <main class="pt-16 pb-20 px-4 h-full ">
      <!-- Banner -->
      <div class="relative rounded-xl overflow-hidden mb-6 h-40">
        <img :src="banner" 
             alt="活动banner" 
             class="w-full h-full">
        <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/60 to-transparent p-4">
          <!-- <h2 class="text-white font-bold text-lg mb-1">积分排行榜</h2> -->
          <!-- <p class="text-white/90 text-sm">活动时间：2023.11.01-2023.11.30</p> -->
        </div>
      </div>


<div class="activity-card">
        <div class="card-header">
            <span class="rules-label">活动规则</span>
            <a href="#" class="detail-link" style="float:right;" @click="contentShow=true">点击查看详细规则</a>
        </div>
        
        <div class="rules-content">
            <p>{{info}}</p>
            <div
              v-if="showActivityGoods"
              :class="[
                'activity-goods-text',
                { 'activity-goods-newline': activityGoodsNewLine },
              ]"
              @click="goToActivityGoods"
            >
              活动商品
            </div>
        </div>
        <div class="rules-content" style="text-align: center;">
        <div class="time-tag">活动时间：{{activity_start_time}} - {{activity_end_time}}</div>
        </div>
    </div>
    <div>
      <!-- Time Tabs -->
    <!-- <van-tabs
        v-model="selected"
		    @click="swichTabTItem"
        style="z-index: 50; height: 50px; line-height: 50px;">  原样式-->
        <van-tabs 
        :sticky="true"
        v-model="selected"
		    @click="swichTabTItem"
        style="z-index: 50;"
        >
        <!-- 绑定一个子组件调用的事件 -->
        <van-tab
          v-for="(item, index) in NavList"
          :key="index"
          :title="item">
          </van-tab>
      </van-tabs>
         <!-- Time Tabs -->
    <van-tabs 
        v-model="selecteItem"
		    @click="swichTabTItem2"
        style="z-index: 50;"
        >
        <!-- 绑定一个子组件调用的事件 -->
        <van-tab
          :title-style="tabSon"
          v-for="(item, index) in NavItemList"
          :key="index"
          :title="item.title">
          </van-tab>
      </van-tabs>
      
      </div>
      <!-- <a href="#" class="detail-link" style="float:right;" @click="timeShow=true">自定义</a> -->
      <!-- <div class="ranking-header2">
       <div style="width: 100%;"><span v-if="myTime">{{myTime}}</span><a href="#" class="detail-link" style="float:right;" @click="searchTime">查询</a>
       <div class="flex items-center space-x-2">
        <el-date-picker
          v-model="my_start_time"
          type="date"
          placeholder="开始日期">
        </el-date-picker>
        <el-date-picker
          v-model="my_end_time"
          type="date"
          placeholder="结束日期">
        </el-date-picker>
        </div>
       </div>
    </div> -->

    <div class="ranking-header">
        <div>排名</div>
        <div style="flex:1; margin-left: 20px;">用户信息</div>
        <div>数量</div>
    </div>
      <!-- Ranking List -->
      <div class="space-y-3">
        <!-- Top 1 -->
        <!-- <div class="bg-white rounded-xl shadow-sm p-4 flex items-center">
          <div class="relative mr-3">
            <div class="w-12 h-12 rounded-full bg-gradient-to-br from-yellow-400 to-yellow-600 flex items-center justify-center text-white font-bold">1</div>
            <img src="https://ai-public.mastergo.com/ai/img_res/2484947639aea3696cc04b92a768927b.jpg" 
                 alt="用户头像" 
                 class="absolute top-0 left-0 w-12 h-12 rounded-full object-cover">
          </div>
          <div class="flex-1">
            <div class="flex items-center justify-between">
              <div>
                <h3 class="font-medium">林小雅</h3>
                <p class="text-gray-500 text-xs">ID: 10086</p>
              </div>
              <div class="text-secondary font-bold">5,842</div>
            </div>
            <div class="mt-2 h-2 bg-gray-100 rounded-full overflow-hidden">
              <div class="h-full bg-gradient-to-r from-yellow-400 to-yellow-600 rounded-full" style="width: 100%"></div>
            </div>
          </div>
        </div> -->

        <!-- Top 2 -->
        <!-- <div class="bg-white rounded-xl shadow-sm p-4 flex items-center">
          <div class="relative mr-3">
            <div class="w-12 h-12 rounded-full bg-gradient-to-br from-gray-300 to-gray-400 flex items-center justify-center text-white font-bold">2</div>
            <img src="https://ai-public.mastergo.com/ai/img_res/1b3d6af80df243206e891d93ea505ef0.jpg" 
                 alt="用户头像" 
                 class="absolute top-0 left-0 w-12 h-12 rounded-full object-cover">
          </div>
          <div class="flex-1">
            <div class="flex items-center justify-between">
              <div>
                <h3 class="font-medium">张明远</h3>
                <p class="text-gray-500 text-xs">ID: 10087</p>
              </div>
              <div class="text-secondary font-bold">4,756</div>
            </div>
            <div class="mt-2 h-2 bg-gray-100 rounded-full overflow-hidden">
              <div class="h-full bg-gradient-to-r from-gray-300 to-gray-400 rounded-full" style="width: 85%"></div>
            </div>
          </div>
        </div> -->

        <!-- Top 3 -->
        <!-- <div class="bg-white rounded-xl shadow-sm p-4 flex items-center">
          <div class="relative mr-3">
            <div class="w-12 h-12 rounded-full bg-gradient-to-br from-amber-500 to-amber-700 flex items-center justify-center text-white font-bold">3</div>
            <img src="https://ai-public.mastergo.com/ai/img_res/3447ff93d1f6b505a7f9166d2cf10f8f.jpg" 
                 alt="用户头像" 
                 class="absolute top-0 left-0 w-12 h-12 rounded-full object-cover">
          </div>
          <div class="flex-1">
            <div class="flex items-center justify-between">
              <div>
                <h3 class="font-medium">王丽华</h3>
                <p class="text-gray-500 text-xs">ID: 10088</p>
              </div>
              <div class="text-secondary font-bold">4,231</div>
            </div>
            <div class="mt-2 h-2 bg-gray-100 rounded-full overflow-hidden">
              <div class="h-full bg-gradient-to-r from-amber-500 to-amber-700 rounded-full" style="width: 75%"></div>
            </div>
          </div>
        </div> -->

        <!-- <van-loading  type="spinner" color="#1989fa" size="24px" vertical>加载中...</van-loading> -->
        <!-- Rank 4-10 -->
        <div class="space-y-3">
          <div v-for="(items, key) in userList" :key="key">
          <div class="bg-white rounded-xl shadow-sm p-4 flex items-center">
            <div v-if="key==0" class="w-8 h-8 rounded-full bg-gradient-to-br from-yellow-400 to-yellow-600 flex items-center justify-center text-white font-bold">{{key+1}}</div>
            <div v-if="key==1" class="w-8 h-8 rounded-full bg-gradient-to-br from-blue-300 to-blue-400 flex items-center justify-center text-white font-bold">{{key+1}}</div>
            <div v-if="key==2" class="w-8 h-8 rounded-full bg-gradient-to-br from-amber-500 to-amber-700 flex items-center justify-center text-white font-bold">{{key+1}}</div>
            <div v-if="key>=3" class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center text-gray-600 font-medium">{{key+1}}</div>
            <!-- <div v-if="key>3">111111</div> -->
            <img :src="items.avatar" 
                 alt="用户头像" 
                 class="w-10 h-10 rounded-full object-cover mr-3 ml-3">
            <div class="flex-1">
              <div class="flex items-center justify-between">
                <div>
                  <h3 class="font-medium">{{items.nickname}}</h3>
                  <p class="text-gray-500 text-xs">ID: {{items.uid}}</p>
                </div>
                <div class="text-secondary font-bold">{{items.amount}}</div>
              </div>
            </div>
          </div>
          </div>
<!--           
          <div class="bg-white rounded-xl shadow-sm p-4 flex items-center">
            <div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center text-gray-600 font-medium mr-3">4</div>
            <img src="https://ai-public.mastergo.com/ai/img_res/59121156cb4de8e23afb45b55fbaea4c.jpg" 
                 alt="用户头像" 
                 class="w-10 h-10 rounded-full object-cover mr-3">
            <div class="flex-1">
              <div class="flex items-center justify-between">
                <div>
                  <h3 class="font-medium">陈志强</h3>
                  <p class="text-gray-500 text-xs">ID: 10089</p>
                </div>
                <div class="text-secondary font-bold">3,987</div>
              </div>
            </div>
          </div> -->
            

        </div>
      </div>
    </main>

    <!-- Tabbar -->
    <!-- <div class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-100 z-10">
      <div class="grid grid-cols-4">
        <button class="py-3 flex flex-col items-center justify-center text-primary">
          <i class="fas fa-home fa-icon w-6 h-6 mb-1"></i>
          <span class="text-xs">首页</span>
        </button>
        <button class="py-3 flex flex-col items-center justify-center text-gray-500">
          <i class="fas fa-chart-line fa-icon w-6 h-6 mb-1"></i>
          <span class="text-xs">排行榜</span>
        </button>
        <button class="py-3 flex flex-col items-center justify-center text-gray-500">
          <i class="fas fa-trophy fa-icon w-6 h-6 mb-1"></i>
          <span class="text-xs">奖励</span>
        </button>
        <button class="py-3 flex flex-col items-center justify-center text-gray-500">
          <i class="fas fa-user fa-icon w-6 h-6 mb-1"></i>
          <span class="text-xs">我的</span>
        </button>
      </div>
    </div> -->
      <!-- 申请协议 -->
    <van-popup v-model="contentShow" :style="{ width: '100%',height:'100%',overflow:'auto'  }" position="right">
      <van-nav-bar title="活动详情">
				<template #left>
					<span>
						<van-icon name="arrow-left" size="18" @click.native="hideAgreement" color='#333' />
					</span>
				</template>
			</van-nav-bar>
      <div v-html="content">
      </div>
    </van-popup>
  </div>
</template>

<script>

import index from "./index";
export default index;

// 这里可以添加响应式数据或方法
</script>

<style scoped>
.fa-icon {
  display: flex;
  justify-content: center;
  align-items: center;
}
body {
            font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            background-color: #FFF5E6; /* 浅橙色背景 */
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
            padding: 20px;
        }
        
        .activity-card {
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            padding: 24px;
            max-width: 500px;
            width: 100%;
        }
        
        .card-header {
            
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .rules-label {
            background-color: white; /* 红色标签 */
            color: #E74C3C;
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 14px;
            font-weight: bold;
        }
        
        .detail-link {
            color: #3498DB; /* 蓝色链接 */
            font-size: 14px;
            text-decoration: none;
            cursor: pointer;
            transition: color 0.2s;
        }
        
        .detail-link:hover {
            color: #2980B9;
            text-decoration: underline;
        }
        
        .rules-content {
            color: #333;
            font-size: 14px;
            line-height: 1.6;
            margin-bottom: 2px;
            position: relative;
        }
        
        .rules-content p {
            margin: 8px 0;
        }
        
        .time-tag {
            background-color: white; /* 红色时间标签 */
            color: #E74C3C;
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 12px;
            display: inline-block;
            margin-top: 1px;
        }
        
        /* 响应式调整 */
        @media (max-width: 480px) {
            .activity-card {
                background-color:rgb(241, 239, 237);
                padding: 16px;
            }
            
            .card-header {
                display: contents;
                flex-direction: column;
                align-items: flex-start;
            }
            
            .detail-link {
                margin-top: 8px;
            }
        }
          .ranking-header {
            display: flex;
            justify-content: space-between;
            padding: 10px 15px;
            background-color: white;
            margin: 10px;
            border-radius: 8px 8px 0 0;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            font-weight: bold;
        }
        .ranking-header2 {
            display: flex;
            background-color: white;
            border-radius: 8px 8px 0 0;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            font-weight: bold;
        }
        .tabSon{
          width: 5px;
        }
.activity-goods-text {
  position: absolute;
  bottom: 0;
  right: 0;
  color: #3498db;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
}

.activity-goods-text:hover {
  color: #2980b9;
}

.activity-goods-newline {
  position: static !important;
  text-align: right;
  margin-top: 8px;
  margin-bottom: 0;
}
</style>

